package com.demo.dao;

import com.demo.entity.operationLog;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface operationLogMapper {
    @Delete({
        "delete from operation_log",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into operation_log (id, type, ",
        "object_id, user_id, ",
        "operation_time, operation_result, ",
        "note)",
        "values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, ",
        "#{objectId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, ",
        "#{operationTime,jdbcType=TIMESTAMP}, #{operationResult,jdbcType=VARCHAR}, ",
        "#{note,jdbcType=VARCHAR})"
    })
    int insert(operationLog record);

    int insertSelective(operationLog record);

    @Select({
        "select",
        "id, type, object_id, user_id, operation_time, operation_result, note",
        "from operation_log",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @ResultMap("com.demo.dao.operationLogMapper.BaseResultMap")
    operationLog selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(operationLog record);

    @Update({
        "update operation_log",
        "set type = #{type,jdbcType=INTEGER},",
          "object_id = #{objectId,jdbcType=VARCHAR},",
          "user_id = #{userId,jdbcType=VARCHAR},",
          "operation_time = #{operationTime,jdbcType=TIMESTAMP},",
          "operation_result = #{operationResult,jdbcType=VARCHAR},",
          "note = #{note,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(operationLog record);
}